package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/channel")
public class IWemediaClientFeign implements IWemediaClient {

    @Autowired
    private WmChannelService channelService;

    @GetMapping("/list")
    @Override
    public ResponseResult getChannels() {
        List<WmChannel> list = channelService.list();
        return ResponseResult.okResult(list);
    }
}
